package com.bltec.emergency.mapper;

import com.bltec.emergency.model.Role;
import org.apache.ibatis.annotations.*;

import java.util.List;


@Mapper
public interface RoleMapper {

    @Insert("insert into sys_role (role_name,role_des,create_by,create_time,enable) values(#{roleName},#{roleDes},#{createBy},#{createTime},#{enable})")
    boolean insert(Role role);

    @Update("update sys_role set role_name=#{roleName},role_des=#{roleDes},update_by=#{updateBy},update_time=#{updateTime} where id=#{id} and enable=1")
    boolean updateRoleById(Role role);

    @Update("update sys_role set enable=0 where id=#{id}")
    boolean setDisableById(Long id);

    @Select("select * from sys_role where id =#{id} and enable=1")
    Role getRoleById(Long id);

    @Select("SELECT * from sys_role where enable=1")
    List<Role> getAll();
}
